<?php
/**
 * Created by 绵阳市碳素云信息技术有限责任公司.
 * User: castle
 * Date: 2015/05/15
 * Time: 20:30
 */

namespace Repair\Controller;

use Repair\Model\LogModel;
use Repair\Model\OrderModel;
use Think\Controller;

class SearchController extends Controller{
    function __construct(){
        parent::__construct();
    }
    function search($keyword){
        $w = 'keywords like \'%'.$keyword.'%\'';
        $OrderModel = new OrderModel();
        $OrderIDs = D('ViewSearch')->where($w)->field('DISTINCT OrderID')->select();
        $Order = '0';
        foreach($OrderIDs as $v){
            $Order .= (','.$v['orderid']);
        }
        if(strlen($Order)>1){
            $this->json($OrderModel->Order($OrderModel->where('OrderID in ('.$Order.')')->select()));
        }
    }
}